from docx.shared import RGBColor, Pt

from datareport.api.enum.ColorEnum import ColorEnum


class Font:
    def __init__(self, type=None, text='', name='宋体', size=10,
                 color: RGBColor = ColorEnum.BLACK.value,
                 bold=False, superscript=False):
        if type is not None:
            self.name = type.name
            self.size: Pt = type.size
            self.color: RGBColor = type.color
            self.bold: bool = type.bold
            self.superscript: bool = type.superscript
            self.section: int = type.section
            self.text = text
        else:
            self.text = text
            self.name = name
            self.size: Pt = Pt(size)
            self.color: RGBColor = color
            self.bold: bool = bold
            self.superscript: bool = superscript
            self.section: int = 1
